/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mx.saco.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author jethro.gutierrez
 */
@Entity
@Table(name = "tt_departamento")
@NamedQueries({
    @NamedQuery(name = "Departamento.findAll", query = "SELECT d FROM Departamento d"),
    @NamedQuery(name = "Departamento.findByIdDepartament", query = "SELECT d FROM Departamento d WHERE d.idDepartament = :idDepartament")})
public class Departamento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_departament")
    private Integer idDepartament;
    @JoinColumn(name = "id_socio", referencedColumnName = "id_socio")
    @ManyToOne
    private Socio idSocio;
    @JoinColumn(name = "id_unidad_habitacional", referencedColumnName = "id_unidad_habitacional")
    @ManyToOne
    private UnidadHabitacional idUnidadHabitacional;

    public Departamento() {
    }

    public Departamento(Integer idDepartament) {
        this.idDepartament = idDepartament;
    }

    public Integer getIdDepartament() {
        return idDepartament;
    }

    public void setIdDepartament(Integer idDepartament) {
        this.idDepartament = idDepartament;
    }

    public Socio getIdSocio() {
        return idSocio;
    }

    public void setIdSocio(Socio idSocio) {
        this.idSocio = idSocio;
    }

    public UnidadHabitacional getIdUnidadHabitacional() {
        return idUnidadHabitacional;
    }

    public void setIdUnidadHabitacional(UnidadHabitacional idUnidadHabitacional) {
        this.idUnidadHabitacional = idUnidadHabitacional;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDepartament != null ? idDepartament.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Departamento)) {
            return false;
        }
        Departamento other = (Departamento) object;
        if ((this.idDepartament == null && other.idDepartament != null) || (this.idDepartament != null && !this.idDepartament.equals(other.idDepartament))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mx.saco.entity.Departamento[ idDepartament=" + idDepartament + " ]";
    }
    
}
